package com.xlq;

import dev.langchain4j.model.openai.OpenAiChatModel;

public class APP {
    public static void main(String[] arg) {
        // 1. 引入依赖
        // 2. 构建OpenAiChatModel对象
        OpenAiChatModel chatModel = OpenAiChatModel.builder()
                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .apiKey(System.getenv("API-KEY"))
                .modelName("qwen-plus")
                .logRequests(true)
                .logResponses(true)
                .build();
        // 3.调用chat方法与大模型交互
        String result = chatModel.chat("你是谁？");
        System.out.println(result);
    }
}
